{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "running build\n",
      "running build_py\n",
      "copying tidecv/data.py -> build/lib/tidecv\n",
      "copying tidecv/datasets.py -> build/lib/tidecv\n",
      "running egg_info\n",
      "writing tidecv.egg-info/PKG-INFO\n",
      "writing dependency_links to tidecv.egg-info/dependency_links.txt\n",
      "writing requirements to tidecv.egg-info/requires.txt\n",
      "writing top-level names to tidecv.egg-info/top_level.txt\n",
      "reading manifest file 'tidecv.egg-info/SOURCES.txt'\n",
      "writing manifest file 'tidecv.egg-info/SOURCES.txt'\n"
     ]
    }
   ],
   "source": [
    "!python setup.py build"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "running install\n",
      "running bdist_egg\n",
      "running egg_info\n",
      "writing tidecv.egg-info/PKG-INFO\n",
      "writing dependency_links to tidecv.egg-info/dependency_links.txt\n",
      "writing requirements to tidecv.egg-info/requires.txt\n",
      "writing top-level names to tidecv.egg-info/top_level.txt\n",
      "reading manifest file 'tidecv.egg-info/SOURCES.txt'\n",
      "writing manifest file 'tidecv.egg-info/SOURCES.txt'\n",
      "installing library code to build/bdist.linux-x86_64/egg\n",
      "running install_lib\n",
      "running build_py\n",
      "creating build/bdist.linux-x86_64/egg\n",
      "creating build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/plotting.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/functions.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/__init__.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/ap.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "creating build/bdist.linux-x86_64/egg/tidecv/errors\n",
      "copying build/lib/tidecv/errors/main_errors.py -> build/bdist.linux-x86_64/egg/tidecv/errors\n",
      "copying build/lib/tidecv/errors/error.py -> build/bdist.linux-x86_64/egg/tidecv/errors\n",
      "copying build/lib/tidecv/errors/__init__.py -> build/bdist.linux-x86_64/egg/tidecv/errors\n",
      "copying build/lib/tidecv/errors/qualifiers.py -> build/bdist.linux-x86_64/egg/tidecv/errors\n",
      "copying build/lib/tidecv/data.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/quantify.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "copying build/lib/tidecv/datasets.py -> build/bdist.linux-x86_64/egg/tidecv\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/plotting.py to plotting.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/functions.py to functions.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/__init__.py to __init__.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/ap.py to ap.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/errors/main_errors.py to main_errors.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/errors/error.py to error.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/errors/__init__.py to __init__.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/errors/qualifiers.py to qualifiers.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/data.py to data.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/quantify.py to quantify.cpython-36.pyc\n",
      "byte-compiling build/bdist.linux-x86_64/egg/tidecv/datasets.py to datasets.cpython-36.pyc\n",
      "creating build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "copying tidecv.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "copying tidecv.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "copying tidecv.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "copying tidecv.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "copying tidecv.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\n",
      "zip_safe flag not set; analyzing archive contents...\n",
      "creating 'dist/tidecv-1.0.1-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it\n",
      "removing 'build/bdist.linux-x86_64/egg' (and everything under it)\n",
      "Processing tidecv-1.0.1-py3.6.egg\n",
      "Copying tidecv-1.0.1-py3.6.egg to /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Adding tidecv 1.0.1 to easy-install.pth file\n",
      "\n",
      "Installed /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages/tidecv-1.0.1-py3.6.egg\n",
      "Processing dependencies for tidecv==1.0.1\n",
      "Searching for matplotlib==3.3.4\n",
      "Best match: matplotlib 3.3.4\n",
      "Adding matplotlib 3.3.4 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for pandas==1.1.5\n",
      "Best match: pandas 1.1.5\n",
      "Adding pandas 1.1.5 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for seaborn==0.11.1\n",
      "Best match: seaborn 0.11.1\n",
      "Adding seaborn 0.11.1 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for opencv-python==4.5.2.54\n",
      "Best match: opencv-python 4.5.2.54\n",
      "Adding opencv-python 4.5.2.54 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for pycocotools==2.0\n",
      "Best match: pycocotools 2.0\n",
      "Processing pycocotools-2.0-py3.6-linux-x86_64.egg\n",
      "pycocotools 2.0 is already the active version in easy-install.pth\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages/pycocotools-2.0-py3.6-linux-x86_64.egg\n",
      "Searching for numpy==1.19.3\n",
      "Best match: numpy 1.19.3\n",
      "Adding numpy 1.19.3 to easy-install.pth file\n",
      "Installing f2py script to /root/miniconda3/envs/deeplabcut/bin\n",
      "Installing f2py3 script to /root/miniconda3/envs/deeplabcut/bin\n",
      "Installing f2py3.6 script to /root/miniconda3/envs/deeplabcut/bin\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for appdirs==1.4.4\n",
      "Best match: appdirs 1.4.4\n",
      "Adding appdirs 1.4.4 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for python-dateutil==2.8.1\n",
      "Best match: python-dateutil 2.8.1\n",
      "Adding python-dateutil 2.8.1 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for pyparsing==2.4.5\n",
      "Best match: pyparsing 2.4.5\n",
      "Adding pyparsing 2.4.5 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for cycler==0.10.0\n",
      "Best match: cycler 0.10.0\n",
      "Adding cycler 0.10.0 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for Pillow==6.2.1\n",
      "Best match: Pillow 6.2.1\n",
      "Adding Pillow 6.2.1 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for kiwisolver==1.1.0\n",
      "Best match: kiwisolver 1.1.0\n",
      "Adding kiwisolver 1.1.0 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for pytz==2019.3\n",
      "Best match: pytz 2019.3\n",
      "Adding pytz 2019.3 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for scipy==1.5.4\n",
      "Best match: scipy 1.5.4\n",
      "Adding scipy 1.5.4 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for Cython==0.29.23\n",
      "Best match: Cython 0.29.23\n",
      "Adding Cython 0.29.23 to easy-install.pth file\n",
      "Installing cygdb script to /root/miniconda3/envs/deeplabcut/bin\n",
      "Installing cython script to /root/miniconda3/envs/deeplabcut/bin\n",
      "Installing cythonize script to /root/miniconda3/envs/deeplabcut/bin\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for setuptools==54.1.2\n",
      "Best match: setuptools 54.1.2\n",
      "Adding setuptools 54.1.2 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Searching for six==1.15.0\n",
      "Best match: six 1.15.0\n",
      "Adding six 1.15.0 to easy-install.pth file\n",
      "\n",
      "Using /root/miniconda3/envs/deeplabcut/lib/python3.6/site-packages\n",
      "Finished processing dependencies for tidecv==1.0.1\n"
     ]
    }
   ],
   "source": [
    "!python setup.py install"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# DEMO\n",
    "from tidecv import TIDE, datasets\n",
    "\n",
    "json_path_src = '/root/yolo5/cp1/valid/coco_valid.json'\n",
    "json_path_rec = '/root/yolo5/yolov5_cp1_v1/runs/detect/coco_valid_rec_61.json'\n",
    "\n",
    "zz = COCO(json_path_src)\n",
    "yy = COCOResult(json_path_rec)\n",
    "\n",
    "tide = TIDE()\n",
    "tide.evaluate(zz, yy, mode=TIDE.BOX) # Use TIDE.MASK for masks\n",
    "tide.summarize()  # Summarize the results as tables in the console\n",
    "tide.plot()       # Show a summary figure. Specify a folder and it'll output a png to that folder."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
